class Solution {
public:
    void Insert(int num) {
        nums.push_back(num);
        sort(this->nums.begin(), this->nums.end());
        if(nums.size() % 2 == 1)
        {
            midNum = nums[nums.size()/2];
        }
        else 
        {
            midNum = (nums[nums.size()/2]+nums[nums.size()/2-1]) / 2.0;
        }
    }

    double GetMedian() { 
        return midNum;    
    }
private:
    double midNum = 0;
    vector<int> nums;
};

class Solution {
public:
    int MoreThanHalfNum_Solution(vector<int>& numbers) {
        sort(numbers.begin(), numbers.end());
        return numbers[numbers.size()/2];
    }
};
